perf: migrate and use fd_base58 algo#379
Merged
HealthyBuilder merged 2 commits intoApr 9, 2026
Merged
Conversation
Contributor
|
@sonicfromnewyoke we also implemented the fd base58 - not sure if it will be more performant or not but just noting down here for reference: https://github.com/Gealber/base58 |
Contributor
Author
the 32-byte speedup comes mostly from hand-written ARM64/AMD64 assembly for the matrix-vector multiply so, i'd recommend migrating to ours implementation right after this MR will be merged |
This was referenced Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
mr-tron/base58is a general-purpose approach with O(n^2) in the input sizefor solana workloads this is a hot path: every
PublicKey.String(),Signature.String(), log line, JSON marshal, and RPC response-parse hits itat a sustained throughput of a few hundred thousand encodes per second, the allocator and divide unit become measurable bottlenecks
Summary of Changes
migrate
fd_base58package specialized for solana's fixed-size types (32-byte pubkeys/hashes, 64-byte signatures)also five8 (which is in use for rust SDK) was used as a reference
Benches
PublicKey.String()PublicKeyFromBase58()PublicKey.MarshalJSON()Signature.String()SignatureFromBase58()base58.AppendEncode32base58.AppendEncode64